package com.xiao.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiao.service.*;
import com.xiao.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;

@RestController
public class BaseController {

    @Autowired
    HttpServletRequest req;

    @Autowired
    RedisUtil redisUtil;

    @Lazy
    @Autowired
    SysUserService sysUserService;

    @Autowired
    SysRoleService sysRoleService;

    @Lazy
    @Autowired
    SysMenuService sysMenuService;

    @Autowired
    SysRoleMenuService sysRoleMenuService;

    @Autowired
    SysUserRoleService sysUserRoleService;

    //分页规则设置
   public Page getPage(){
       int current = ServletRequestUtils.getIntParameter(req, "cuurent", 1);
       int size = ServletRequestUtils.getIntParameter(req, "size", 10);

       return new Page(current,size);
   }


}
